package com.yulongtian.oneProblemEveryDay.month202212;

/**
 * https://leetcode.cn/problems/minimum-operations-to-make-the-array-increasing/
 *
 * @author yulongTian
 * @create 2022-12-11 14:36
 */
public class Test06 {
    public static void main(String[] args) {

    }

    public int minOperations(int[] nums) {
        int len=nums.length;
        if(len==1){
            return 0;
        }

        int res=0;
        for (int i = 1; i < len; i++) {
            if(nums[i]<=nums[i-1]){
                res+=nums[i-1]+1-nums[i];
                nums[i]=nums[i-1]+1;
            }


        }


        return res;
    }

}
